export default {
	data() {
		return {
			// 村社区选择
			showXqPicker: false,
			xqColumns: [],
		}
	},
	methods: {
        getXqColumns() {
            var vm = this;
            vm.getAndLoad('获取小区', vm.globalConfig.getXqjwApi || '/api/miniapp/v1/getGrid.jsp', function(res) {
                vm.xqColumns = [res.data, res.data[0].child];
            });
        },
        onXqConfirm(e) {
            var item = this.formItems.find(n => (n.prop == this.currentProp));
            this.model[item.prop] = e.value[1].name;
            var propsuffix = item.propEndFix || '';
            if (item.bindId) {
                if (item.bindId[0] + propsuffix) {
                    this.model[item.bindId[0] + propsuffix] = e.value[1].id;
                }
                if (item.bindId[1] + propsuffix) {
                    this.model[item.bindId[1] + propsuffix] = e.value[1].wgbm;
                }
            } else {
                this.model['gridId' + propsuffix] = e.value[1].id;
                this.model['wgbmId' + propsuffix] = e.value[1].wgbm;
            }
            
        
            this.showXqPicker = false;
        },
        onXqChange(e) {
            const {
                columnIndex,
                index,
                // 微信小程序无法将picker实例传出来，只能通过ref操作
                picker = this.getRefCmp('xqPicker')
            } = e;
            // debugger
            if (columnIndex === 0) {
                picker.setColumnValues(1, this.xqColumns[0][index].child);
            }
        },
    },
}
